package es.ats.codington.festival.services;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import es.ats.codington.festival.daos.ManagerDAOImp;
import es.ats.codington.festival.daos.PlaceDAOImp;
import es.ats.codington.festival.domain.Museum;
import es.ats.codington.festival.domain.Places;
import es.ats.codington.festival.interfaces.daos.IPlaceDAOImp;
import es.ats.codington.festival.interfaces.services.IPlaceService;
import es.ats.codington.festival.utils.FERSDataConnection;

public class PlaceDAOService implements IPlaceService{

	int nRows = 0;
	private Connection con;
	IPlaceDAOImp placeDAO;



	public PlaceDAOService() {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");  
		ManagerDAOImp managerDAO = (ManagerDAOImp) ctx.getBean("daoManager");
		this.placeDAO = managerDAO.getPlaceDAO();
	}
	
	/**
	 *  GETTER methods for PlaceDAOService class 
	 * @return
	 */
	
	public Places getPlaceByIdService(int placeId){
		return placeDAO.getPlaceById(placeId);
	}
	
	/**
	 *  SETTER methods for PlaceDAOService class 
	 * @return
	 */
	public int insertPlaceService(Places places){
		return placeDAO.insertPlace(places);
	}
	/**
	 *  SETTER methods for PlaceDAOService class 
	 * @return
	 */
	public int updatePlaceService(Places places){
		return placeDAO.updatePlace(places);
	}
	/**
	 *  SETTER methods for PlaceDAOService class 
	 * @return
	 */
	public int deletePlaceService(int placeId){
		return placeDAO.deletePlace(placeId);
	}
	/**
	 *  GETTER methods for PlaceDAOService class 
	 * @return
	 */
	public ArrayList<Places> getAllPlacesService(){
		return placeDAO.getAllPlaces();
	}
	
}
